package com.weasel.weixin.commons.message;

import com.weasel.http.HttpClientSecretary;
import com.weasel.weixin.commons.CommonRequest;
import com.weasel.weixin.commons.config.CommonConfig;
import com.weasel.weixin.commons.config.CommonConsts;
import com.weasel.weixin.commons.message.bean.initiative.AbstractCustomInitiativeMessage;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

/**
 * Created by Dylan on 2015/10/19.
 */
public class CustomInitiativeMessageRequest extends CommonRequest {


    public CustomInitiativeMessageRequest(CommonConfig config) {
        super(config);
    }


    public CustomInitiativeMessageResponse sendMessage(AbstractCustomInitiativeMessage message) throws IOException, ExecutionException {

        CustomInitiativeMessageResponse response = HttpClientSecretary.post()
                                                                      .withURI(getBaseUrl(CommonConsts.INITIATIVE_SEND_MESSAGE_URL))
                                                                      .withParam(message)
                                                                      .doItWithJson(CustomInitiativeMessageResponse.class);
        return response;
    }


}
